<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<c:import url="../cabecalho.jsp" />
<c:import url="../menu.jsp" />
<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
	<div class="row">
		<ol class="breadcrumb">
			<li><a href="#"><span class="glyphicon glyphicon-home"></span></a></li>
			<li class="active"><fmt:message key="consulta.reparos" /></li>
		</ol>
	</div>
	<div class="row">
		<div class="col-lg-12">
			<h1 class="page-header">
				<fmt:message key="consulta.reparos" />
			</h1>
		</div>
	</div>
	<form:form role="form" id="formConsultaReparoOemAdmin" commandName="filtroReparoOem">
		<div class="row">
			<div class="col-lg-10 col-md-10">
				<div class="panel panel-default">
					<div class="panel-heading cab">
						<fmt:message key="filtrodedados" />
					</div>
					<div class="panel-body">
						<div class="col-md-12 col-lg-12">
							<div class="form-group col-md-6 col-lg-6">
								<form:label path="nomeCriadorReparo"><fmt:message key="cadastro.usuario.dadosusuario.ascconcessionaria" /></form:label> 
								<form:select path="nomeCriadorReparo" id="autorizada" class="form-control">
									<form:option path="nomeCriadorReparo" value=""></form:option>
									<c:forEach items="${autorizadas}" var="autorizada">
										<form:option path="nomeCriadorReparo" value="${autorizada.nomeAutorizada}">${autorizada.nomeAutorizada}</form:option>
									</c:forEach>
								</form:select>
							</div>	
							<div class="form-group col-md-3 col-lg-3">
								<form:label path="entradaDeReparoDe">
									<fmt:message key="consulta.reparos.entradareparode" />
								</form:label>
								<form:input path="entradaDeReparoDe" cssClass="form-control datepicker"/>
							</div>
							<div class="form-group col-md-3 col-lg-3">
								<form:label path="entradaDeReparoAte">
									<fmt:message key="consulta.reparos.entradareparoate" />
								</form:label>
								<form:input path="entradaDeReparoAte" cssClass="form-control datepicker"/>
							</div>
							
						</div>
						<div class="col-md-12 col-lg-12">
							<div class="form-group col-md-3 col-lg-3">
								<form:label path="finalizacaoReparoDe">
									<fmt:message key="consulta.reparos.finalizacaoreparode" />
								</form:label>
								<form:input path="finalizacaoReparoDe" cssClass="form-control datepicker"/>
							</div>
							<div class="form-group col-md-3 col-lg-3">
								<form:label path="finalizacaoReparoAte">
									<fmt:message key="consulta.reparos.finalizacaoreparoate" />
								</form:label>
								<form:input path="finalizacaoReparoAte" cssClass="form-control datepicker"/>
							</div>
							<div class="form-group col-md-3 col-lg-3">
								<form:label path="dataModificacaoDe">
									<fmt:message key="consulta.reparos.datamodificacaode" />
								</form:label>
								<form:input path="dataModificacaoDe" cssClass="form-control datepicker"/>
							</div>
							<div class="form-group col-md-3 col-lg-3">
								<form:label path="dataModificacaoAte">
									<fmt:message key="consulta.reparos.datamodificacaoate" />
								</form:label>
								<form:input path="dataModificacaoAte" cssClass="form-control datepicker"/>
							</div>
							
						</div>
						<div class="col-md-12 col-lg-12">
							<div class="form-group col-md-3 col-lg-3">
								<form:label path="modelo">
									<fmt:message key="modelo" />
								</form:label>
								<form:select path="modelo" cssClass="form-control">
									<form:option path="modelo" value=""></form:option>
									<c:forEach items="${dadosBasicos}" var="dadoBasico">
										<form:option path="modelo" value="${dadoBasico.modelo}">${dadoBasico.modelo}</form:option>
									</c:forEach>
								</form:select>
							</div>
							<div class="form-group col-md-3 col-lg-3">
								<form:label path="numeroSerie">
									<fmt:message key="numeroserie" />
								</form:label>
								<form:input path="numeroSerie" cssClass="form-control"/>
							</div>
							<div class="form-group col-md-2 col-lg-2">
								<form:label path="status">
									<fmt:message key="status" />
								</form:label>
								<form:select path="status" cssClass="form-control">
									<form:option path="status" value=""></form:option>
									<c:forEach items="${status}" var="st">
										<form:option path="status" value="${st}"><fmt:message key="${st.descricao}"/></form:option>
									</c:forEach>
								</form:select>
							</div>
							<div class="form-group col-md-2 col-lg-2">
								<form:label path="numeroReparo">
									<fmt:message key="numeroreparo" />
								</form:label>
								<form:input path="numeroReparo" cssClass="form-control"/>
							</div>
							<div class="form-group col-md-2 col-lg-2">
								<form:label path="ordemServico">
									<fmt:message key="ordemservico" />
								</form:label>
								<form:input path="ordemServico" cssClass="form-control"/>
							</div>
						</div>
						<div class="col-md-12 col-lg-12">
							<div class="form-group col-md-12 col-lg-12">
								<button type="button" id="bt_consultarReparoOemAdmin" class="btn btn-primary direita">
									<fmt:message key="consultar" />
								</button>
							</div>
						</div>
					</div>
					
					
					<c:if test="${not empty reparos}">
						<div class="panel-heading cab">
							<fmt:message key="consulta" />
						</div>
						<div class="panel-body">
							<div class="col-lg-12">
								<table class="table table-hover">
									<thead>
										<tr>
											<th>
												<fmt:message key="asc" />
											</th>
											<th>
												<fmt:message key="status" />
											</th>
											<th>
												<fmt:message key="numeroreparo" />
											</th>
											<th>
												<fmt:message key="modelo" />
											</th>
											<th>
												<fmt:message key="numeroserie" />
											</th>
											<th>
												<fmt:message key="datacriacao" />
											</th>
											<th>
												<fmt:message key="visualizar" />
											</th>
										</tr>
									</thead>
									<c:forEach items="${reparos}" var="reparo">
										<tr>
											<td>${reparo.nomeCriadorReparo}</td>
											<td><fmt:message key="${reparo.status.descricao}"/></td>
											<td>${reparo.id}</td>
											<td>${reparo.produto.dadosBasicos.modelo}</td>
											<td>${reparo.produto.numeroDeSerie}</td>
											<td><fmt:formatDate value="${reparo.dataDeCriacao.time}" pattern="dd/MM/yyyy" /></td>
											<td>
											<a href="editarReparoOemAdmin?id=${reparo.id}"><span class="glyphicon glyphicon-check" aria-hidden="true"></span></a>
											</td>
										</tr>
									</c:forEach>
								</table>
							</div>
						</div>
					</c:if>
				</div>
			</div>
		</div>
	</form:form>
</div>

<script>
	$("#bt_consultarReparoOemAdmin").click(function(){
		$("#formConsultaReparoOemAdmin").attr("action", "buscarReparosOemAdmin");
		$("#formConsultaReparoOemAdmin").submit();
	});
	
	
</script>
<c:import url="../rodape.jsp" />
